package com.wan37.logic.utils;

import com.wan37.logic.domain.vo.RoleLevelVO;
import com.wan37.logic.domain.vo.SkillLevelVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author : luoyong
 * @date : 2020-06-22 16:53
 **/
@Component
public class SkillLevelUtil {

    private final static Logger logger = LoggerFactory.getLogger(SkillLevelUtil.class);

    /**
     * 技能等级对应的技能加强
     */
    public Map<String, Float> skillLevelMap = new ConcurrentHashMap<>();

    /**
     * 技能等级加强数值获取
     *
     * @param path
     */
    public void readSkillLevelXml(String path) {
        XmlUtil<SkillLevelVO> xmlUtil = new XmlUtil<>();
        List<SkillLevelVO> skillLevelVOList = xmlUtil.getXmlFileValues(path, SkillLevelVO.class);
        for (SkillLevelVO skillLevelVO : skillLevelVOList) {
            skillLevelMap.put(skillLevelVO.getId(), skillLevelVO.getEnhance());
        }
        logger.info("技能等级数值Map集合配置完成！！！！！");
    }
}
